package com.slz3.business.module.wmsManagement.wmsStockDetailItems.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsStockDetailItems.domain.WmsStockDetailItems;
import com.slz3.business.module.wmsManagement.wmsStockDetailItems.domain.WmsStockDetailItemsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsStockDetailItemsTransactionalServiceImpl implements WmsStockDetailItemsTransactionalService {

    @Override
    public WmsStockDetailItems modify(WmsStockDetailItems wmsStockDetailItemsNew) {
        Repositorys.wmsStockDetailItems.test();
        Repositorys.wmsStockDetailItems.save(WmsStockDetailItemsFactory.initBaseFields());
        System.err.println(1/0);
        wmsStockDetailItemsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsStockDetailItems.saveAndFlush(wmsStockDetailItemsNew);
    }

    @Override
    public List<WmsStockDetailItems> batchModify(List<WmsStockDetailItems> wmsStockDetailItemsList) {
        return Repositorys.wmsStockDetailItems.saveAll(wmsStockDetailItemsList);
    }
}
